package com.jiangjiang.eshop.order.price.v1.factory;

import com.jiangjiang.eshop.order.price.v1.calculator.FreightCalculator;
import com.jiangjiang.eshop.order.price.v1.calculator.PromotionActivityCalculator;
import com.jiangjiang.eshop.order.price.v1.calculator.TotalPriceCalculator;
import com.jiangjiang.eshop.order.price.v1.calculator.impl.DefaultFreightCalculator;
import com.jiangjiang.eshop.order.price.v1.calculator.impl.DefaultPromotionActivityCalculator;
import com.jiangjiang.eshop.order.price.v1.calculator.impl.DefaultTotalPriceCalculator;
import com.jiangjiang.eshop.promotion.dto.PromotionActivityDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author Jianghaowen
 * @Date 2021/7/14
 * @Description: 默认订单金额计算工厂
 * @Version V1.0
 **/
@Component
public class DefaultOrderPriceCalculatorFactory implements OrderPriceCalculatorFactory {
    @Autowired
    private DefaultPromotionActivityCalculator defaultPromotionActivityCalculator;
    @Autowired
    private DefaultTotalPriceCalculator defaultTotalPriceCalculator;
    @Autowired
    private DefaultFreightCalculator defaultFreightCalculator;

    /**
     *  创建订单价格计算组件
     * @return
     */
    @Override
    public TotalPriceCalculator createTotalPriceCalculator() {
        return defaultTotalPriceCalculator;
    }

    /**
     * 创建运费计算组件
     * @return
     */
    @Override
    public FreightCalculator createFreightCalculator() {
        return defaultFreightCalculator;
    }

    /**
     * 创建营销活动优惠计算组件
     * @param promotionActivity 营销活动
     * @return
     */
    @Override
    public PromotionActivityCalculator createPromotionActivityCalculator(PromotionActivityDTO promotionActivity) {
        return defaultPromotionActivityCalculator;
    }
}
